<template>
  <div class="recommend">
    <div class="wrap">
      <div class="rem-header">
        <div class="header-left">
          <img src="@/assets/img/jingpin.png" alt="" />
          <h2>精品推荐</h2>
        </div>
        <div class="header-right" @click="$router.push('/moreGoods?did=1')">
          <span>更多</span>
          <img src="@/assets/img/arrow.png" alt="" />
        </div>
      </div>
      <ul class="rem-list">
        <Item v-for="item in jingpinList" :key="item.id" :data="item" />
      </ul>
    </div>
  </div>
</template>

<script>
import Item from "@/components/index/Item.vue";
import { JingpinAPI } from "@/request/api.js";
export default {
  data() {
    return {
      jingpinList: [],
    };
  },
  components: {
    Item,
  },
  props: {
    title: {
      type: String,
      default: "",
    },
  },
  async created() {
    let res = await JingpinAPI();
    this.jingpinList = res.data.data.data.records;
    // console.log(this.jingpinList);
  },
};
</script>

<style lang="less" scoped>
.recommend {
  padding: 45px 0;
  background: #f5f5f5;
  .rem-header {
    height: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: SourceHanSansSC;
    .header-left {
      display: flex;
      font-size: 30px;
      font-weight: bold;
      color: #242b39;
      h2 {
        margin-left: 20px;
      }
    }
    .header-right {
      display: flex;
      cursor: pointer;
      span {
        margin-right: 10px;
        &:hover {
          color: #f40;
        }
      }
    }
  }
}
</style>